program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  a, n, sum, i: integer;

begin
  read (n);
  sum:= 0;
  for i:= 0 to n*n-1 do
  begin
    read  (a);
    if (a=1) then
      inc(sum);
  end;
  write (sum shr 1);
end.
